package com.masita.ventanas;

import javax.swing.ImageIcon;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;

public class PanelPaneles extends JTabbedPane {

	private VentanaPrincipal padre = null;
	
	public PanelPaneles(VentanaPrincipal p){
		super();
		this.padre = p;
	}
	
	public void addPanel(JPanel p, String titulo, String ico){
		
		ImageIcon icono = new ImageIcon(getClass().getResource(ico));
		
		this.addTab(titulo,icono,p);
		
		this.setSelectedComponent(p);
	}
	
	public void remPanel(JPanel p){
		if( this.indexOfComponent(p) > -1 )
			this.removeTabAt(this.indexOfComponent(p));
	}
	
	public TablaDatos getTablaActual(){		
		if( this.getTabCount() > 0 ){
			return ((InterfaceTabla)this.getSelectedComponent()).getTabla();
		}
		return null;
	}
}
